<?php

    if( ! isset($_SESSION) ) header('Location: index.php');

    require_once('../inc/DBH.php');
    require_once('../inc/Model/Usuario.php');
    require_once('../inc/Model/Linea.php');

    $collection = array();
    foreach( Linea::GetCollection() as $p ) {
        $a           = array();
        $a['id']     = $p->get_id();
        $a['nombre'] = $p->get_nombre();
        array_push( $collection, $a );
    }
?>

<!DOCTYPE html>
<html lang="es-ES">
<head>
    <title>BRAFHCOM S.R.L.</title>
    <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="../css/reset.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css">
    <link rel="stylesheet" type="text/css" href="../css/backend.css">
    <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../js/Utils.js"></script>
    <script type="text/javascript" src="../js/Brafh.js"></script>
    <script type="text/javascript">
        $( window ).ready( function() {
            var handler = new $.Brafh.Backend();
            handler.Start();
        });
    </script>
</head>
<body>
    <span id="logout" class="boton">Cerrar sesi&oacute;n</span>
    <div id="container">
        <div id="linea_nueva" class="formulario">
            <span class="title">Agregar nueva l&iacute;nea</span>
            <div class="row">
                <span>Nombre</span>
                <input class="textbox" name="linea_nombre">
            </div>
            <div class="submit">
                <span class="boton" name="linea_crear">Agregar</span>
            </div>
        </div>
        <br>
        <br>
        <br>
        <br>
        <br>
        <div id="producto_nuevo" class="formulario">
            <span class="title">Agregar nuevo producto</span>
            <div class="row">
                <span>Nombre</span>
                <input class="textbox" name="producto_nombre">
            </div>
            <div class="row">
                <span>L&iacute;nea</span>
                <select class="select" name="producto_linea">
                    <option value="seleccionar">Seleccionar...</option>
                    <option value="blanco">&nbsp;</option>
                    <?php foreach( $collection as $l ) echo '<option value="'.$l['id'].'">'.$l['nombre'].'</option>'; ?>
                </select>
            </div>
            <div class="row">
                <span>Tipo de producto</span>
                <select class="select" name="producto_tipo"></select>
            </div>
            <div class="row">
                <span>Fuente de energ&iacute;a</span>
                <input class="textbox" name="producto_energia">
            </div>
            <div class="row">
                <span>Caracter&iacute;sticas</span>
                <textarea class="textbox" name="producto_caracteristicas" rows="10" cols="8"></textarea>
            </div>
            <div class="submit">
                <span class="boton" name="producto_crear">Agregar</span>
            </div>
        </div>
    </div>
</body>
</html>